[jQuery] JSON response is null, but the URL is echoing correctly.
Posted
by b. e. hollenbeck
on Stack Overflow
See other posts from Stack Overflow
or by b. e. hollenbeck
Published on 2010-04-20T21:52:58Z
Indexed on
2010/04/20
22:23 UTC
Read the original article
Hit count: 431
I have a form being AJAX'd in by jQuery on a page with multiple forms. I'm performing the following function, which is a wrapper for the $.ajax
function:
function do_json_get(uri){
var ret = '';
var url = AJAX_URL + uri;
$.ajax({
type: 'GET',
url: url,
async: false,
success: function(data) {
ret = data.html;
},
dataType: 'json'
});
return ret;
}
When I go to the AJAX server directly (which is rendering the form in PHP), I get the raw JSON response - so I know the server is outputting to the browser, and the AJAX server is doing other things like setting the proper cookies, so I know that the connection is good (I get a 200 response code). Yet the data
object is coming back null.
What else could I be missing?
© Stack Overflow or respective owner